feat(nemo-gym): train on rollouts from external agent harnesses - #3407
Draft
ananthsub wants to merge 7 commits into
Draft
feat(nemo-gym): train on rollouts from external agent harnesses#3407ananthsub wants to merge 7 commits into
ananthsub wants to merge 7 commits into
Conversation
ananthsub
force-pushed
the
ananthsub/token-id-capture-rebased
branch
from
July 29, 2026 12:41
a1feb66 to
8b4f737
Compare
This was referenced Aug 5, 2026
cmunley1
reviewed
Aug 7, 2026
ananthsub
force-pushed
the
ananthsub/token-id-capture-rebased
branch
from
August 18, 2026 16:57
a6c65af to
de2d246
Compare
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
ananthsub
force-pushed
the
ananthsub/token-id-capture-rebased
branch
from
August 27, 2026 22:27
8335e15 to
93f23d3
Compare
Group harness rollouts by their source prompt rather than model-visible prompt tokens, and carry those identities through dynamic sampling, replay, the data plane, and checkpoint restore. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Update Gym to 62cabfd4 and isolate its dependency source so uv can lock Gym's OpenAI 2.44 pin separately from SGLang's OpenAI 2.6.1 pin. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Explicitly select the nemo-rl package so container builds resolve backend extras after Gym moves from a workspace member to an editable path dependency. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Generate the split Gym and SGLang resolution with uv 0.11.28 so the container's frozen backend syncs can select their optional dependencies. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Pick up Gym's opt-in rollout latency stamping fix for NeMo-RL direct callers and refresh the lockfile with the container's uv version. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
ananthsub
force-pushed
the
ananthsub/token-id-capture-rebased
branch
from
September 5, 2026 02:57
93f23d3 to
a61114c
Compare
Contributor
Author
|
/ok to test a61114c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trains on rollouts from an agent harness that drives its own model calls and returns no token IDs.
Gym captures the exact token IDs and log probabilities inside its model server and rebuilds each rollout into a trainable Responses payload. NeMo-RL assigns rollout identity, constructs the
TokenSourceinside its rollout actor, consumes the rebuilt result, and retires the frozen capture only after the rollout consumer accepts it.Depends on the Gym stack: NVIDIA-NeMo/Gym#2190, #2124, #2125, #2126, #2341, #2180, #2181, and #2349.
Control and data flow
sequenceDiagram autonumber participant RL as NemoGym actor participant G as Gym run_examples participant H as Agent harness participant M as Gym model-server worker participant K as TokenSink participant S as TokenSource participant T as Trainer consumer RL->>RL: Run token_source_factory inside actor RL->>RL: Assign _ng_rollout_id RL->>G: Dispatch selected rows G->>H: Run agent H->>M: Model calls under /training-token-capture/{rollout_id} M->>K: Append TokenEntry records G-->>RL: Return rollout without token metadata RL->>S: Freeze and read snapshot RL->>RL: Rebuild response and preserve original media items RL-->>T: Yield trainable rollout T-->>RL: Request next rollout RL->>S: Conditionally retire accepted snapshotIntegration behavior
token_id_capture.all_agents: trueopts every agent into capture for training-only runs._build_token_capture_sourceuses a localTokenCaptureStorewhentoken_id_capture.diris configured.token_source_factorytospinup_nemo_gym_actor. Ray serializes the factory with the actor constructor, and the factory runs inside the actor process and virtual environment.TokenSourceprotocol. It may wrap a TransferQueue handle or any other framework-owned transport client.TokenSinkandLineageStoreproxies in their own processes. Their adapter package must be installed in the model-server environment.shutdown()closes the actor-owned source before stopping Gym servers.Source construction
The default file adapter is selected with
token_id_capture.dir. A framework data plane injects an actor-local factory instead of naming a source class in Gym configuration.The source must implement Gym's
TokenSourceprotocol:freeze, conditionaldrop, and idempotentclose. The model-server side uses the correspondingTokenSinkandLineageStoreprotocols supplied by the framework.Metrics
The integration reports
token_capture/rebuilt_fraction,rollouts_rebuilt,rollouts_unbuilt,calls_per_rollout_mean,chains_per_rollout_mean,delivered_fraction_mean,quarantined_fraction_mean,empty_generation_calls,parent_link_failures,masked_rollouts, andincomplete_rollouts.